<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="com.park.layout.Blocks" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%-- JSTL表达式（判断，循环，输出） --%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%-- 方法表达式（字符串截取，替换） --%>
<%@ taglib uri="http://www.wanwei.com/tags/tag" prefix="layout" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<layout:override name="<%=Blocks.BLOCK_HEADER_CSS%>">
    <link href="Content/style/common/style.min.css?v=${static_resource_version}" rel="stylesheet" type="text/css">
</layout:override>

<layout:override name="<%=Blocks.BLOCK_HEADER_SCRIPTS%>">
    <script src="Content/lib/jquery/jquery.validate/jquery.validate.js?v=${static_resource_version}"></script>
    <script src="Content/lib/jquery/jquery.validate.unobtrusive/jquery.validate.unobtrusive.js?v=${static_resource_version}"></script>
    <script>
        $(document).ready(function () {
            // 配置表单校验
            $('#center_form').validate({
                ignore: ":hidden"
            });
        });

        function confirmAdd(){
            $.post("<%=basePath%>member/addAdminOperator", $("#add_form").serialize(), function (res) {
                alert(res.message);
                if(res.code == 1){
                    window.location.href='<%=basePath%>member/memberAdminList';
                }
            });
        }
    </script>
</layout:override>

<layout:override name="<%=Blocks.BLOCK_BODY%>">
    <div class="container-fluid" style="text-align: left">
        <form id="add_form" class="form-horizontal" novalidate onsubmit="return false;">
            <div class="panel panel-default">
                <div class="panel-heading">编辑员工</div>
                <div class="panel-body">
                    <div class="col-sm-offset-2 col-sm-8">
                        <div class="form-group">
                            <input type="hidden" name="id" value="${member.id}" />
                            <label for="user_password" class="col-sm-4 control-label">
                                <span class="text-danger">*</span> 员工登录账号
                            </label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="user_password" name="operatorMobile"
                                       placeholder="请输入员工登录账号" autocomplete="off"
                                       data-val="true" data-val-required="员工登录账号不能为空" value="${member.operatorMobile}">
                                <div data-valmsg-for="oldPwd" data-valmsg-replace="true"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="new_password" class="col-sm-4 control-label">
                                <span class="text-danger">*</span> 员工姓名
                            </label>

                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="new_password" name="operatorName"
                                       placeholder="请输入员工姓名" autocomplete="off"
                                       data-val="true" data-val-required="员工姓名不能为空" value="${member.operatorName}">
                                <div data-valmsg-for="newPwd" data-valmsg-replace="true"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="confirm_password" class="col-sm-4 control-label">
                                <span class="text-danger">*</span> 员工密码
                            </label>

                            <div class="col-sm-8">
                                <input type="password" class="form-control" id="confirm_password" name="operatorPwd"
                                       placeholder="请输入员工密码" autocomplete="off"
                                       data-val="true" data-val-required="员工密码不能为空"value="${member.operatorPwd}">
                                <div data-valmsg-for="confirmPwd" data-valmsg-replace="true"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="text-center">
                                <button type="submit" class="btn btn-success password-confirm" onclick="confirmAdd()">
                                    <span class="glyphicon glyphicon-ok"></span> 保 存
                                </button>
                                <button type="button" class="btn col-sm-4" style="width: 150px; float: right;" onclick="window.history.go(-1);">
                                    <span class="glyphicon"></span> 返回
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</layout:override>

<c:import url="../Shared/Layout.jsp">
    <c:param name="title" value="员工编辑"/>
</c:import>
